import request from '@/utils/request'
// 定义模块前缀
const prefix = '/article'

// 获取文章列表
export const getArticleList = (params) => {
	return request({
	    url: `${prefix}/getArticleList`,
	    method: 'get',
        params
	})
}

// 获取文章分类
export const getClassifyList = () => {
	return request({
	    url: `${prefix}/getClassifyList`,
	    method: 'get',
	})
}

// 添加文章
export const addArticle = (data) => {
	return request({
	    url: `${prefix}/addArticle`,
	    method: 'post',
        data
	})
}

// 添加文章观看次数
export const addViewCount = (data) => {
	return request({
	    url: `${prefix}/addViewCount`,
	    method: 'post',
        data
	})
}

// 获取文章详情
export const getArticleDetail = (params) => {
	return request({
	    url: `${prefix}/getArticleDetail`,
	    method: 'get',
        params
	})
}

// 获取用户文章列表
export const getUserArticleList = (params) => {
	return request({
	    url: `${prefix}/getUserArticleList`,
	    method: 'get',
        params
	})
}

// 查询用户各个文章状态数量
export const getArticleStateCount = () => {
	return request({
	    url: `${prefix}/getArticleStateCount`,
	    method: 'get',
	})
}

// 删除文章接口
export const delArticle = (data) => {
	return request({
	    url: `${prefix}/delArticle`,
	    method: 'delete',
        data
	})
}

// 修改文章接口
export const updateArticle = (data) => {
	return request({
	    url: `${prefix}/updateArticle`,
	    method: 'put',
        data
	})
}

// 申请发布文章接口
export const applyPublish = (data) => {
	return request({
	    url: `${prefix}/applyPublish`,
	    method: 'put',
        data
	})
}

// 发布文章接口
export const publishArticle = (data) => {
	return request({
	    url: `${prefix}/publishArticle`,
	    method: 'put',
        data
	})
}

// 撤回审核接口
export const revokeExamine = (data) => {
	return request({
	    url: `${prefix}/revokeExamine`,
	    method: 'put',
        data
	})
}

// 撤销发布文章接口
export const revokeArticle = (data) => {
	return request({
	    url: `${prefix}/revokeArticle`,
	    method: 'put',
        data
	})
}

// 评论文章接口
export const commentArticle = (data) => {
	return request({
	    url: `${prefix}/commentArticle`,
	    method: 'post',
        data
	})
}

// 获取文章评论列表
export const getCommentList = (params) => {
	return request({
	    url: `${prefix}/getCommentList`,
	    method: 'get',
        params
	})
}

// 删除评论接口
export const delComment = (data) => {
	return request({
	    url: `${prefix}/delComment`,
	    method: 'delete',
        data
	})
}

// 获取用户是否给文章点赞
export const getLikeArticleState = (params) => {
	return request({
	    url: `${prefix}/getLikeArticleState`,
	    method: 'get',
        params
	})
}

// 点赞文章接口
export const likeArticle = (data) => {
	return request({
	    url: `${prefix}/likeArticle`,
	    method: 'post',
        data
	})
}

// 用户是否给评论点赞
export const likeComment = (data) => {
	return request({
	    url: `${prefix}/likeComment`,
	    method: 'post',
        data
	})
}

// 获取用户是否给评论点赞
export const getLikeCommentState = (params) => {
	return request({
	    url: `${prefix}/getLikeCommentState`,
	    method: 'get',
        params
	})
}

// 获取所有父子评论总数
export const getCommentTotalCount = params => {
    return request({
        url: `${prefix}/getCommentTotalCount`,
        method: 'get',
        params
    })
}

// 举报评论接口
export const reportComment = (data) => {
	return request({
	    url: `${prefix}/reportComment`,
	    method: 'post',
        data
	})
}
